import axios from "axios"

var Login = (item) => {
    var fs = 0
    var ret = 1990;
    ret = axios.get("/js/user.json").then(res => {
        var list = res.data.user.datalist
        var flag = 0;
        for (var i in list) {
            if (list[i].email === item.username) {
                flag = 1;
                if (list[i].pwd === item.password) {
                    fs = 1;

                } else {
                    fs = 0
                }
                break
            }
        }
        if (flag == 0) {
            fs = -1;
        }
        return fs
    })

    return ret
}

export { Login }